home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / EDITORS / MEMACS / H / Edef < prev    next >
Text File  |  1990-06-26  |  17KB  |  352 lines

  1. /*    EDEF:        Global variable definitions for
  2.             MicroEMACS 3.9
  3.  
  4.                         written by Daniel Lawrence
  5.                         based on code by Dave G. Conroy,
  6.                             Steve Wilhite and George Jones
  7. */
  8.  
  9. #ifdef    maindef
  10.  
  11. /* for MAIN.C */
  12.  
  13. /* initialized global definitions */
  14.  
  15. NOSHARE int DNEAR fillcol = 72;     /* Current fill column        */
  16. NOSHARE short kbdm[NKBDM];        /* Macro            */
  17. NOSHARE char *execstr = NULL;        /* pointer to string to execute */
  18. NOSHARE char golabel[NPAT] = "";    /* current line to go to    */
  19. NOSHARE char lterm[NSTRING];        /* line terminators on file write */
  20. NOSHARE unsigned char wordlist[256];    /* characters considered "in words" */
  21. NOSHARE int DNEAR wlflag = FALSE;    /* word list enabled flag    */
  22. NOSHARE int DNEAR execlevel = 0;    /* execution IF level        */
  23. NOSHARE int DNEAR eolexist = TRUE;    /* does clear to EOL exist?    */
  24. NOSHARE int DNEAR revexist = FALSE;    /* does reverse video exist?    */
  25. NOSHARE int DNEAR flickcode = TRUE;    /* do flicker supression?    */
  26. CONST char *modename[] = {         /* name of modes        */
  27.     "WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER",
  28.     "MAGIC", "CRYPT", "ASAVE", "REP"};
  29. CONST char modecode[] = "WCSEVOMYAR";    /* letters to represent modes    */
  30. NOSHARE int DNEAR numfunc = NFUNCS;    /* number of bindable functions */
  31. NOSHARE int DNEAR gmode = 0;        /* global editor mode        */
  32. NOSHARE int DNEAR gflags = GFREAD;    /* global control flag        */
  33. NOSHARE int DNEAR gfcolor = 7;        /* global forgrnd color (white) */
  34. NOSHARE int DNEAR gbcolor = 0;        /* global backgrnd color (black)*/
  35. NOSHARE int DNEAR gasave = 256;     /* global ASAVE size        */
  36. NOSHARE int DNEAR gacount = 256;    /* count until next ASAVE    */
  37. NOSHARE int DNEAR sgarbf = TRUE;     /* TRUE if screen is garbage    */
  38. NOSHARE int DNEAR mpresf = FALSE;    /* TRUE if message in last line */
  39. NOSHARE int DNEAR clexec = FALSE;    /* command line execution flag    */
  40. NOSHARE int DNEAR mstore = FALSE;    /* storing text to macro flag    */
  41. NOSHARE int DNEAR discmd = TRUE;     /* display command flag     */
  42. NOSHARE int DNEAR disinp = TRUE;     /* display input characters    */
  43. NOSHARE int DNEAR modeflag = TRUE;    /* display modelines flag    */
  44. NOSHARE int DNEAR popflag = TRUE;    /* pop-up windows enabled?    */
  45. NOSHARE int cpending = FALSE;        /* input character pending?    */
  46. NOSHARE int charpending;        /* character pushed back    */
  47. NOSHARE int DNEAR sscroll = FALSE;    /* smooth scrolling enabled flag*/
  48. NOSHARE int DNEAR hscroll = TRUE;    /* horizontal scrolling flag    */
  49. NOSHARE int DNEAR hjump = 1;        /* horizontal jump size     */
  50. NOSHARE int DNEAR ssave = TRUE;     /* safe save flag        */
  51. NOSHARE struct BUFFER *bstore = NULL;    /* buffer to store macro text to*/
  52. NOSHARE int DNEAR vtrow = 0;        /* Row location of SW cursor    */
  53. NOSHARE int DNEAR vtcol = 0;        /* Column location of SW cursor */
  54. NOSHARE int DNEAR ttrow = HUGE;     /* Row location of HW cursor    */
  55. NOSHARE int DNEAR ttcol = HUGE;     /* Column location of HW cursor */
  56. NOSHARE int DNEAR lbound = 0;        /* leftmost column of current line
  57.                        being displayed        */
  58. NOSHARE int DNEAR taboff = 0;        /* tab offset for display    */
  59. NOSHARE int DNEAR tabsize = 8;        /* current hard tab size    */
  60. NOSHARE int DNEAR stabsize = 0;        /* current soft tab size (0: use hard tabs)  */
  61. NOSHARE int DNEAR reptc = CTRL | 'U';    /* current universal repeat char*/
  62. NOSHARE int DNEAR abortc = CTRL | 'G';    /* current abort command char    */
  63. NOSHARE int DNEAR sterm = CTRL | '[';    /* search terminating character */
  64. NOSHARE int DNEAR searchtype = SRNORM;    /* current search style        */
  65. NOSHARE int DNEAR yanktype = SRNORM;    /* current yank style        */
  66.  
  67. NOSHARE int DNEAR prefix = 0;        /* currently pending prefix bits */
  68. NOSHARE int DNEAR prenum = 0;        /*     "       "     numeric arg */
  69. NOSHARE int DNEAR predef = TRUE;    /*     "       "     default flag */
  70.  
  71. NOSHARE int DNEAR quotec = CTRL | 'Q';    /* quote char during mlreply() */
  72. NOSHARE CONST char *cname[] = {        /* names of colors        */
  73.     "BLACK", "RED", "GREEN", "YELLOW", "BLUE",
  74.     "MAGENTA", "CYAN", "GREY",
  75.     "GRAY", "LRED", "LGREEN", "LYELLOW", "LBLUE",
  76.     "LMAGENTA", "LCYAN", "WHITE"};
  77. NOSHARE KILL *kbufp = NULL;        /* current kill buffer chunk pointer*/
  78. NOSHARE KILL *kbufh = NULL;        /* kill buffer header pointer    */
  79. NOSHARE int kused = KBLOCK;        /* # of bytes used in kill buffer*/
  80. NOSHARE WINDOW *swindow = NULL;     /* saved window pointer     */
  81. NOSHARE int cryptflag = FALSE;        /* currently encrypting?    */
  82. NOSHARE int oldcrypt = FALSE;        /* using old(broken) encryption? */
  83. NOSHARE short *kbdptr;            /* current position in keyboard buf */
  84. NOSHARE short *kbdend = &kbdm[0];    /* ptr to end of the keyboard */
  85. NOSHARE int DNEAR kbdmode = STOP;    /* current keyboard macro mode    */
  86. NOSHARE int DNEAR kbdrep = 0;        /* number of repetitions    */
  87. NOSHARE int DNEAR restflag = FALSE;    /* restricted use?        */
  88. NOSHARE int DNEAR lastkey = 0;        /* last keystoke        */
  89. NOSHARE int DNEAR seed = 0;        /* random number seed        */
  90. NOSHARE long envram = 0l;        /* # of bytes current in use by malloc */
  91. NOSHARE int DNEAR macbug = FALSE;    /* macro debugging flag        */
  92. NOSHARE int DNEAR mouseflag = TRUE;    /* use the mouse?        */
  93. NOSHARE int DNEAR diagflag = FALSE;    /* diagonal mouse movements?    */
  94. CONST char errorm[] = "ERROR";        /* error literal        */
  95. CONST char truem[] = "TRUE";        /* true literal         */
  96. CONST char falsem[] = "FALSE";        /* false litereal        */
  97. NOSHARE int DNEAR cmdstatus = TRUE;    /* last command status        */
  98. NOSHARE char palstr[49] = "";        /* palette string        */
  99. NOSHARE char lastmesg[NSTRING] = "";     /* last message posted        */
  100. NOSHARE char *lastptr = NULL;        /* ptr to lastmesg[]        */
  101. NOSHARE int DNEAR saveflag = 0;     /* Flags, saved with the $target var */
  102. NOSHARE char *fline = NULL;        /* dynamic return line        */
  103. NOSHARE int DNEAR flen = 0;        /* current length of fline    */
  104. NOSHARE int DNEAR rval = 0;        /* return value of a subprocess */
  105. NOSHARE int DNEAR eexitflag = FALSE;    /* EMACS exit flag        */
  106. NOSHARE int DNEAR eexitval = 0;     /* and the exit return value    */
  107. NOSHARE int xpos = 0;        /* current column mouse is positioned to*/
  108. NOSHARE int ypos = 0;        /* current screen row         "        */
  109. NOSHARE int nclicks = 0;    /* cleared on any non-mouse event    */
  110. NOSHARE int disphigh = FALSE;    /* display high bit chars escaped    */
  111.  
  112. /* uninitialized global definitions */
  113.  
  114. NOSHARE int DNEAR currow;    /* Cursor row            */
  115. NOSHARE int DNEAR curcol;    /* Cursor column        */
  116. NOSHARE int DNEAR thisflag;    /* Flags, this command        */
  117. NOSHARE int DNEAR lastflag;    /* Flags, last command        */
  118. NOSHARE int DNEAR curgoal;    /* Goal for C-P, C-N        */
  119. NOSHARE WINDOW *curwp;         /* Current window        */
  120. NOSHARE BUFFER *curbp;         /* Current buffer        */
  121. NOSHARE WINDOW *wheadp;        /* Head of list of windows    */
  122. NOSHARE BUFFER *bheadp;        /* Head of list of buffers     */
  123. NOSHARE SCREEN *first_screen;    /* Head of list of screens    */
  124. NOSHARE BUFFER *blistp;        /* Buffer for C-X C-B        */
  125. NOSHARE BUFFER *slistp;        /* Buffer for A-B        */
  126. NOSHARE SCREEN *cur_screen;    /* ptr to the current screen    */
  127. NOSHARE int DNEAR scr_num;    /* number of the current screen */
  128.  
  129. NOSHARE char sres[NBUFN];    /* current screen resolution    */
  130.  
  131. NOSHARE    char lowcase[HICHAR];    /* lower casing map        */
  132. NOSHARE    char upcase[HICHAR];    /* upper casing map        */
  133.  
  134. NOSHARE char pat[NPAT];        /* Search pattern        */
  135. NOSHARE char tap[NPAT];        /* Reversed pattern array.    */
  136. NOSHARE char rpat[NPAT];    /* replacement pattern        */
  137.  
  138. /*    Various "Hook" execution variables    */
  139.  
  140. NOSHARE KEYTAB readhook;    /* executed on all file reads */
  141. NOSHARE KEYTAB wraphook;    /* executed when wrapping text */
  142. NOSHARE KEYTAB cmdhook;        /* executed before looking for a command */
  143. NOSHARE KEYTAB writehook;    /* executed on all file writes */
  144. NOSHARE KEYTAB exbhook;        /* executed when exiting a buffer */
  145. NOSHARE KEYTAB bufhook;        /* executed when entering a buffer */
  146.  
  147. /*    The variable matchlen holds the length of the matched string -
  148.     used by the replace functions. The variable patmatch holds the
  149.     string that satisfies the search command. The variables matchline
  150.     and matchoff hold the line and offset position of the *start* of
  151.     match.
  152. */
  153.  
  154. NOSHARE unsigned int DNEAR matchlen = 0;
  155. NOSHARE unsigned int DNEAR mlenold  = 0;
  156. NOSHARE char *patmatch = NULL;
  157. NOSHARE LINE *matchline = NULL;
  158. NOSHARE int DNEAR matchoff = 0;
  159.  
  160. #if    MAGIC
  161. /*
  162.  * The variables magical and rmagical determine if there
  163.  * were actual metacharacters in the search and replace strings -
  164.  * if not, then we don't have to use the slower MAGIC mode
  165.  * search functions.
  166.  */
  167. NOSHARE short DNEAR magical = FALSE;
  168. NOSHARE short DNEAR rmagical = FALSE;
  169. NOSHARE MC mcpat[NPAT];     /* the magic pattern        */
  170. NOSHARE MC tapcm[NPAT];     /* the reversed magic pattern    */
  171. NOSHARE RMC rmcpat[NPAT];    /* the replacement magic array    */
  172.  
  173. #endif
  174.  
  175. /* directive name table:
  176.     This holds the names of all the directives....    */
  177.  
  178. CONST char *dname[] = {
  179.     "if", "else", "endif",
  180.     "goto", "return", "endm",
  181.     "while", "endwhile", "break",
  182.     "force"
  183. };
  184.  
  185. #if    DEBUGM
  186. /*    vars needed for macro debugging output    */
  187. NOSHARE char outline[NSTRING];    /* global string to hold debug line text */
  188. #endif
  189.  
  190. #else
  191.  
  192. /* for all the other .C files */
  193.  
  194. /* initialized global external declarations */
  195.  
  196. NOSHARE extern int DNEAR fillcol;    /* Current fill column        */
  197. NOSHARE extern short kbdm[];        /* Holds kayboard macro data    */
  198. NOSHARE extern char *execstr;        /* pointer to string to execute */
  199. NOSHARE extern char golabel[];        /* current line to go to    */
  200. NOSHARE extern char lterm[];        /* line terminators on file write */
  201. NOSHARE extern unsigned char wordlist[];/* characters considered "in words" */
  202. NOSHARE extern int DNEAR wlflag;    /* word list enabled flag    */
  203. NOSHARE extern int DNEAR execlevel;    /* execution IF level        */
  204. NOSHARE extern int DNEAR eolexist;    /* does clear to EOL exist?    */
  205. NOSHARE extern int DNEAR revexist;    /* does reverse video exist?    */
  206. NOSHARE extern int DNEAR flickcode;    /* do flicker supression?    */
  207. CONST extern char *modename[];        /* text names of modes        */
  208. CONST extern char modecode[];        /* letters to represent modes    */
  209. NOSHARE extern int DNEAR numfunc;    /* number of bindable functions */
  210. NOSHARE extern KEYTAB keytab[];        /* key bind to functions table    */
  211. NOSHARE extern NBIND names[];        /* name to function table    */
  212. NOSHARE extern int DNEAR gmode;        /* global editor mode        */
  213. NOSHARE extern int DNEAR gflags;    /* global control flag        */
  214. NOSHARE extern int DNEAR gfcolor;    /* global forgrnd color (white) */
  215. NOSHARE extern int DNEAR gbcolor;    /* global backgrnd color (black)*/
  216. NOSHARE extern int DNEAR gasave;    /* global ASAVE size        */
  217. NOSHARE extern int DNEAR gacount;    /* count until next ASAVE    */
  218. NOSHARE extern int DNEAR sgarbf;    /* State of screen unknown    */
  219. NOSHARE extern int DNEAR mpresf;    /* Stuff in message line    */
  220. NOSHARE extern int DNEAR clexec;    /* command line execution flag    */
  221. NOSHARE extern int DNEAR mstore;    /* storing text to macro flag    */
  222. NOSHARE extern int DNEAR discmd;    /* display command flag     */
  223. NOSHARE extern int DNEAR disinp;    /* display input characters    */
  224. NOSHARE extern int DNEAR modeflag;    /* display modelines flag    */
  225. NOSHARE extern int DNEAR popflag;    /* pop-up windows enabled?    */
  226. NOSHARE extern int cpending;        /* input character pending?    */
  227. NOSHARE extern int charpending;        /* character pushed back    */
  228. NOSHARE extern int DNEAR sscroll;    /* smooth scrolling enabled flag*/
  229. NOSHARE extern int DNEAR hscroll;    /* horizontal scrolling flag    */
  230. NOSHARE extern int DNEAR hjump;        /* horizontal jump size     */
  231. NOSHARE extern int DNEAR ssave;        /* safe save flag        */
  232. NOSHARE extern struct BUFFER *bstore;    /* buffer to store macro text to*/
  233. NOSHARE extern int DNEAR vtrow;        /* Row location of SW cursor    */
  234. NOSHARE extern int DNEAR vtcol;        /* Column location of SW cursor */
  235. NOSHARE extern int DNEAR ttrow;        /* Row location of HW cursor    */
  236. NOSHARE extern int DNEAR ttcol;        /* Column location of HW cursor */
  237. NOSHARE extern int DNEAR lbound;    /* leftmost column of current line
  238.                        being displayed        */
  239. NOSHARE extern int DNEAR taboff;    /* tab offset for display    */
  240. NOSHARE extern int DNEAR tabsize;    /* current hard tab size    */
  241. NOSHARE extern int DNEAR stabsize;    /* current soft tab size (0: use hard tabs)  */
  242. NOSHARE extern int DNEAR reptc;        /* current universal repeat char*/
  243. NOSHARE extern int DNEAR abortc;    /* current abort command char    */
  244. NOSHARE extern int DNEAR sterm;        /* search terminating character */
  245. NOSHARE extern int DNEAR searchtype;    /* current search style        */
  246. NOSHARE extern int DNEAR yanktype;    /* current yank style        */
  247.  
  248. NOSHARE extern int DNEAR prefix;    /* currently pending prefix bits */
  249. NOSHARE extern int DNEAR prenum;    /*     "       "     numeric arg */
  250. NOSHARE extern int DNEAR predef;    /*     "       "     default flag */
  251.  
  252. NOSHARE extern int DNEAR quotec;    /* quote char during mlreply() */
  253. NOSHARE extern CONST char *cname[];    /* names of colors        */
  254. NOSHARE extern KILL *kbufp;        /* current kill buffer chunk pointer */
  255. NOSHARE extern KILL *kbufh;        /* kill buffer header pointer    */
  256. NOSHARE extern int kused;        /* # of bytes used in kill buffer*/
  257. NOSHARE extern WINDOW *swindow;     /* saved window pointer     */
  258. NOSHARE extern int cryptflag;        /* currently encrypting?    */
  259. NOSHARE extern int oldcrypt;        /* using old(broken) encryption? */
  260. NOSHARE extern short *kbdptr;        /* current position in keyboard buf */
  261. NOSHARE extern short *kbdend;        /* ptr to end of the keyboard */
  262. NOSHARE extern int kbdmode;        /* current keyboard macro mode    */
  263. NOSHARE extern int kbdrep;        /* number of repetitions    */
  264. NOSHARE extern int restflag;        /* restricted use?        */
  265. NOSHARE extern int lastkey;        /* last keystoke        */
  266. NOSHARE extern int seed;        /* random number seed        */
  267. NOSHARE extern long envram;        /* # of bytes current in use by malloc */
  268. NOSHARE extern int DNEAR macbug;    /* macro debugging flag        */
  269. NOSHARE extern int DNEAR mouseflag;    /* use the mouse?        */
  270. NOSHARE extern int DNEAR diagflag;    /* diagonal mouse movements?    */
  271. CONST extern char errorm[];        /* error literal        */
  272. CONST extern char truem[];        /* true literal         */
  273. CONST extern char falsem[];        /* false litereal        */
  274. NOSHARE extern int DNEAR cmdstatus;    /* last command status        */
  275. NOSHARE extern char palstr[];        /* palette string        */
  276. NOSHARE extern char lastmesg[];        /* last message posted        */
  277. NOSHARE extern char *lastptr;        /* ptr to lastmesg[]        */
  278. NOSHARE extern int DNEAR saveflag;    /* Flags, saved with the $target var */
  279. NOSHARE extern char *fline;         /* dynamic return line */
  280. NOSHARE extern int DNEAR flen;         /* current length of fline */
  281. NOSHARE extern int DNEAR rval;         /* return value of a subprocess */
  282. NOSHARE extern int DNEAR eexitflag;    /* EMACS exit flag */
  283. NOSHARE extern int DNEAR eexitval;    /* and the exit return value */
  284. NOSHARE extern int xpos;        /* current column mouse is positioned to */
  285. NOSHARE extern int ypos;        /* current screen row         "     */
  286. NOSHARE extern int nclicks;        /* cleared on any non-mouse event*/
  287. NOSHARE extern int disphigh;        /* display high bit chars escaped*/
  288.  
  289. /* uninitialized global external declarations */
  290.  
  291. NOSHARE extern int DNEAR currow;    /* Cursor row            */
  292. NOSHARE extern int DNEAR curcol;    /* Cursor column        */
  293. NOSHARE extern int DNEAR thisflag;    /* Flags, this command        */
  294. NOSHARE extern int DNEAR lastflag;    /* Flags, last command        */
  295. NOSHARE extern int DNEAR curgoal;    /* Goal for C-P, C-N        */
  296. NOSHARE extern WINDOW *curwp;         /* Current window        */
  297. NOSHARE extern BUFFER *curbp;         /* Current buffer        */
  298. NOSHARE extern WINDOW *wheadp;        /* Head of list of windows    */
  299. NOSHARE extern BUFFER *bheadp;        /* Head of list of buffers    */
  300. NOSHARE extern SCREEN *first_screen;    /* Head of list of screens    */
  301. NOSHARE extern BUFFER *blistp;        /* Buffer for C-X C-B        */
  302. NOSHARE extern BUFFER *slistp;        /* Buffer for A-B        */
  303. NOSHARE extern SCREEN *cur_screen;    /* ptr to the current screen    */
  304. NOSHARE extern int DNEAR scr_num;    /* number of the current screen */
  305.  
  306. NOSHARE extern char sres[NBUFN];    /* current screen resolution    */
  307.  
  308. NOSHARE    extern char lowcase[HICHAR];    /* lower casing map        */
  309. NOSHARE    extern char upcase[HICHAR];    /* upper casing map        */
  310.  
  311. NOSHARE extern char pat[];        /* Search pattern        */
  312. NOSHARE extern char tap[];        /* Reversed pattern array.    */
  313. NOSHARE extern char rpat[];         /* replacement pattern        */
  314.  
  315. /*    Various "Hook" execution variables    */
  316.  
  317. NOSHARE extern KEYTAB readhook;        /* executed on all file reads */
  318. NOSHARE extern KEYTAB wraphook;        /* executed when wrapping text */
  319. NOSHARE extern KEYTAB cmdhook;        /* executed before looking for a cmd */
  320. NOSHARE extern KEYTAB writehook;    /* executed on all file writes */
  321. NOSHARE extern KEYTAB exbhook;        /* executed when exiting a buffer */
  322. NOSHARE extern KEYTAB bufhook;        /* executed when entering a buffer */
  323.  
  324. NOSHARE extern unsigned int matchlen;
  325. NOSHARE extern unsigned int mlenold;
  326. NOSHARE extern char *patmatch;
  327. NOSHARE extern LINE *matchline;
  328. NOSHARE extern int matchoff;
  329.  
  330. #if    MAGIC
  331. NOSHARE extern short magical;
  332. NOSHARE extern short rmagical;
  333. NOSHARE extern MC mcpat[NPAT];        /* the magic pattern        */
  334. NOSHARE extern MC tapcm[NPAT];        /* the reversed magic pattern    */
  335. NOSHARE extern RMC rmcpat[NPAT];    /* the replacement magic array    */
  336. #endif
  337.  
  338. CONST extern char *dname[];        /* directive name table     */
  339.  
  340. #if    DEBUGM
  341. /*    vars needed for macro debugging output    */
  342. NOSHARE extern char outline[];    /* global string to hold debug line text */
  343. #endif
  344.  
  345. #endif
  346.  
  347. /* terminal table defined only in TERM.C */
  348.  
  349. #ifndef termdef
  350. NOSHARE extern TERM    term;        /* Terminal information.    */
  351. #endif
  352.